package com.ymatou.iapi.csim.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.RemoveIndividualDiscourseByCategoryIdBean;
import com.ymatou.iapi.csim.parameter.SaveOrUpdateIndividualDiscourseBean;
import com.ymatou.iapi.csim.parameter.SaveOrUpdateIndividualDiscourseCategoryBean;
import com.ymatou.iapi.csim.service.RemoveIndividualDiscourseByCategoryIdCall;
import com.ymatou.iapi.csim.service.SaveOrUpdateIndividualDiscourseCall;
import com.ymatou.iapi.csim.service.SaveOrUpdateIndividualDiscourseCategoryCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CsimCallService;
import com.ymttest.database.model.ymt_individualdiscourse;
import com.ymttest.database.model.ymt_individualdiscoursecatetory;
import com.ymttest.database.sqlwapper.CSIM.ymt_individualdiscourseWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_individualdiscoursecatetoryWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
/**
*删除个人话术
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_RemoveIndividualDiscourseByCategoryId{
	private static RemoveIndividualDiscourseByCategoryIdBean bean;
	private static RemoveIndividualDiscourseByCategoryIdCall call;
	private Integer csId=Integer.parseInt(EnvSetup.getData("csId").toString());
	private static ymt_individualdiscourseWapper individualdiscourseWapper=new ymt_individualdiscourseWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("删除个人话术");
	}

	@Before
	public void caseUp() {
		bean=new RemoveIndividualDiscourseByCategoryIdBean();
		call=new RemoveIndividualDiscourseByCategoryIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_RemoveIndividualDiscourseByCategoryId_1() {
		Logger.start(true,"删除个人话术");
		try {
			Logger.comment("前置条件-新增话术");
			SaveOrUpdateIndividualDiscourseBean saveorupdateindividualdiscourseBean=new SaveOrUpdateIndividualDiscourseBean();
			SaveOrUpdateIndividualDiscourseCall saveorupdateindividualdiscourseCall=new SaveOrUpdateIndividualDiscourseCall();
			
			saveorupdateindividualdiscourseBean.setId(TestDataManager.getRandomUUID().toString());
			saveorupdateindividualdiscourseBean.setCategoryId(TestDataManager.getRandomUUID().toString());
			saveorupdateindividualdiscourseBean.setTitle("自动化测试_"+TestDataManager.getRandomNum(5));
			saveorupdateindividualdiscourseBean.setSort(1);
			saveorupdateindividualdiscourseCall.setData(saveorupdateindividualdiscourseBean);
			saveorupdateindividualdiscourseCall.callService();
			
			bean.setId(saveorupdateindividualdiscourseBean.getId());
			call.setData(bean);
			call.callService();		
			//验证
			Logger.verifyEquals("0", saveorupdateindividualdiscourseCall.getResult().get("ErrorCode").toString(), "验证errorCode");
			Logger.verifyEquals(true, saveorupdateindividualdiscourseCall.getResult().get("Success"), "验证Success");
			Logger.verifyEquals("200", saveorupdateindividualdiscourseCall.getStatus(), "验证Status");
			ymt_individualdiscourse catetory=individualdiscourseWapper.selectByPrimaryKey(saveorupdateindividualdiscourseBean.getId());
			Logger.verifyEquals(null, catetory.getId(), "验证Id");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}